home *** CD-ROM | disk | FTP | other *** search
/ The Genius of Edison / The Genius of Edison (Version 1.0)(Softkey Multimedia)(GOE744AE-CD)(1996).ISO / pc / data / shared.cst / 00039_Script_BACK LIST < prev    next >
Text File  |  1996-09-03  |  5KB  |  174 lines

  1. -- --------------------------------------------------------
  2. -- Handler addCurrentSectionToBackList adds the given sectionName to
  3. -- a list of visited sections to be used by the back button.
  4.  
  5. on addCurrentSectionToBackList
  6.   global backList, backFlag, currentSection, currentSubSection
  7.   
  8.   -- note: the first time this is called, it will be sent a void
  9.   -- parameter. only add nonVoid values.
  10.   
  11.   --  note:  only add the sceneName to the list if:
  12.   -- 1) the back button was not clicked (to prevent going back and forth
  13.   -- between two sections by clicking numerous times on the
  14.   -- back button)
  15.   -- 2) the current section is not already at the end of the back list
  16.   -- (to prevent them from clicking one section numerous times on the
  17.   -- menu and then going back to the same section numerous times).
  18.   
  19.   if not(backFlag) and (LastBackListSection() <> [currentSection, currentSubSection]) and not(voidP(backList)) then
  20.     add(backList, list(currentSection, currentSubSection))
  21.   end if
  22. end
  23.  
  24. -- --------------------------------------------------------
  25. -- Handler lastBackListSection returns the section part of 
  26. -- the last item in the backList.
  27.  
  28. on LastBackListSection
  29.   global backList
  30.   
  31.   if voidP(backList) then
  32.     return EMPTY
  33.   else
  34.     return getLast(backList)
  35.   end if
  36. end
  37.  
  38. -- --------------------------------------------------------
  39. -- Handler doClickBack goes to the last section visited.
  40.  
  41. on doClickBack
  42.   global backList , fingerCursor
  43.   -- global backPressedAlready
  44.   
  45.   --  if not backPressedAlready then
  46.   -- ensure that we do not enter this body of code until 'back' movie is loaded
  47.   --    set backPressedAlready = 1
  48.   set numScenes = count(backList)
  49.   if (numScenes) then -- backList is not empty
  50.     -- set the cursor to watchCursor this way because
  51.     -- the other way (calling the watchCursor handler) is
  52.     -- not working write
  53.     set the cursor of sprite the clickOn = 4
  54.     --set the cursor of sprite the clickOn = fingerCursor 
  55.     set lastScene = getAt(backList,numScenes)
  56.     deleteAt(backList,numScenes) -- remove from list
  57.     setBackFlag(TRUE)
  58.     goBack(lastScene)
  59.   end if
  60.   --  end if
  61. end
  62.  
  63. -- --------------------------------------------------------
  64. -- Handler setBackFlag sets the global variable backFlag to
  65. -- the given value. This is used in maintaining the global
  66. -- variable backList.
  67.  
  68. on setBackFlag val
  69.   global backFlag
  70.   
  71.   set backFlag = val
  72. end
  73.  
  74. -- --------------------------------------------------------
  75. -- Handler checkBackRoll sets the cursor to a finger cursor
  76. -- if the user rolled over the back part of the menu bar.
  77.  
  78. on checkBackRoll mousePoint
  79.   global backRect, fingerCursor , backCoverUpSprite
  80.   
  81.   if inside(mousePoint, backRect) then
  82.     cursor fingerCursor   
  83.   else
  84.     cursor -1            
  85.   end if
  86. end
  87.  
  88. -- --------------------------------------------------------
  89. -- Handler goBack goes to the beginning of the given scene
  90.  
  91. on goBack whichPlace
  92.   global menuBarSprite
  93.   -- global backPressedAlready
  94.   set lastSection = getAt(whichPlace, 1)
  95.   set lastSubSection = getAt(whichPlace, 2)
  96.   
  97.   if (lastSection = "wheel") then
  98.     goWheel
  99.   else if (lastSection = "database") then
  100.     goDatabase
  101.   else if (lastSection = "timeline") then
  102.     goTimeLine
  103.   else if (lastSection = "index") then
  104.     goIndex
  105.   else if (lastSection = "help") then
  106.     goHelp
  107.   else if (lastSection = "tour") then
  108.     goTour
  109.   else if (lastSection = "quiz") then
  110.     goQuiz
  111.   else if isInventionName(lastSection) then
  112.     setInventionSectionInfo(lastSection)
  113.     
  114.     if (lastSubSection = "Toms Technology") then
  115.       goTomsTechnology
  116.     else if (lastSubSection = "Daily Edisonian") then
  117.       goDailyEdisonian
  118.     else if (lastSubSection = "Time Marches On") then
  119.       goTimeMarchesOn
  120.     else if (lastSubSection = "Kinetoscope") then
  121.       goKinetoscope
  122.     else if (lastSubSection = "Kinetograph") then
  123.       goKinetograph
  124.     else if (lastSubSection = "Morse") then
  125.       goMorse
  126.     end if
  127.   end if
  128.   
  129.   --  set backPressedAlready = 0
  130.   set the cursor of sprite menuBarSprite = 0
  131. end
  132.  
  133. -- --------------------------------------------------------
  134. -- Handler isInventionName returns TRUE if the given term
  135. -- is an invention and FALSE otherwise.
  136.  
  137. on isInventionName term
  138.   global inventionData
  139.   
  140.   return (BinSearchFirstItemInLine(inventionData, term, ",") <> 0)
  141. end
  142.  
  143. -- --------------------------------------------------------
  144. -- Handler setCurrentSection sets the global variable 
  145. -- currentSection to the given value (a variable used in maintaing
  146. -- the backlist).
  147.  
  148. on setCurrentSection which
  149.   global currentSection
  150.   
  151.   set currentSection = which
  152. end
  153.  
  154. on initializeCurrentSection
  155.   global currentSection
  156.   
  157.   -- because for now, ie is also done in the database and help,
  158.   -- check if it is void - that means it is coming from the wheel
  159.   -- for the first time.
  160.   if voidP(currentSection) then
  161.     setCurrentSection("wheel")
  162.   end if
  163. end
  164.  
  165. -- --------------------------------------------------------
  166. -- Handler setCurrentSubSection sets the global variable 
  167. -- currentSubSection to the given value (a variable used in maintaing
  168. -- the backlist).
  169.  
  170. on setCurrentSubSection which
  171.   global currentSubSection
  172.   
  173.   set currentSubSection = which
  174. end